package com.doyoo.controller;

import com.doyoo.service.impl.CoreApiService;
import io.kubernetes.client.openapi.ApiException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api")
@Tag(name = "核心core")
public class CoreApiController {

    @Autowired
    private CoreApiService coreApiService;

    @PostMapping(value = "/listNamespace")
    @Operation(summary = "listNamespace")
    public Object listNamespace() throws ApiException {
        return coreApiService.listNamespace();
    }

    @PostMapping(value = "/createNamespace/{namespace}")
    @Operation(summary = "createNamespace")
    public Object createNamespace(@PathVariable("namespace") String namespace) throws ApiException {
        return coreApiService.createNamespace(namespace);
    }

    @DeleteMapping(value = "/deleteNamespace/{namespace}")
    @Operation(summary = "deleteNamespace")
    public Object deleteNamespace(@PathVariable("namespace") String namespace) throws ApiException {
        return coreApiService.deleteNamespace(namespace);
    }

    @PostMapping(value = "/listNode")
    @Operation(summary = "listNode")
    public Object listNode() throws ApiException {
        return coreApiService.listNode();
    }
}
